package ai.plantdata.Behavior.mode.CommandPattern.test;

import ai.plantdata.Behavior.mode.CommandPattern.classes.Broker;
import ai.plantdata.Behavior.mode.CommandPattern.classes.Stock;
import ai.plantdata.Behavior.mode.CommandPattern.interfaces.impl.BuyStock;
import ai.plantdata.Behavior.mode.CommandPattern.interfaces.impl.SellStock;

/**
 * @Author: WangHui
 * @Date: 2020/12/23 11:22
 * @Description:
 */
public class CommandPatternDemo {
    public static void main(String[] args) {
        //包含请求
        Stock abcStock = new Stock();

        //对象中包裹着命令
        BuyStock buyStockOrder = new BuyStock(abcStock);
        SellStock sellStockOrder = new SellStock(abcStock);

        Broker broker = new Broker();
        broker.tackOrder(buyStockOrder);
        broker.tackOrder(sellStockOrder);

        //执行请求
        broker.placeOrders();
    }
}
